package com.sgb.kjwl.view.ui.adapter.packers;

import android.content.Context;

import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.AppItemMemberLeagerCompanyBinding;
import com.sgb.kjwl.model.entity.user.AddressEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;
import com.sgb.link.view.adapter.PageRecycleAdapter;

import java.util.List;

/**
*@author younghow
*@date 2021/9/23
*description:会员单位的adapter
*/
public class MainMemberCompanyAdapter extends PageRecycleAdapter<AddressEntity> {

    public MainMemberCompanyAdapter(Context context, List<AddressEntity> data) {
        super(context, R.layout.app_item_member_leager_company, data);
    }

    @Override
    public void convert(com.sgb.link.view.adapter.ItemViewHolder holder, AddressEntity addressEntity) {
        AppItemMemberLeagerCompanyBinding binding = (AppItemMemberLeagerCompanyBinding) holder.getmBinding();
        if (addressEntity.getName() != null){
            binding.imgBack.setText(addressEntity.getName().length() > 6 ? String.format("%s...>",addressEntity.getName().substring(0,6)) : String.format("%s>",addressEntity.getName()));
        }else {
            binding.imgBack.setText("");
        }
    }
}